/* 手机端样式 - DrawGuessMobile.vue */
.mobile-container {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  font-family: 'Arial', sans-serif;
}

.connection-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  text-align: center;

  h1 {
    color: white;
    margin-bottom: 30px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
  }

  h2 {
    color: white;
    margin-bottom: 20px;
    font-size: 1.8em;
  }
}

.error-message {
  background: rgba(255, 255, 255, 0.9);
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);

  p {
    margin: 10px 0;
    color: #333;
    font-size: 1.1em;
  }
}

.connection-info {
  background: rgba(255, 255, 255, 0.9);
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);

  p {
    margin: 10px 0;
    color: #333;
    font-size: 1.2em;
  }
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

.drawing-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: white;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: #4a90e2;
  color: white;

  h2 {
    margin: 0;
    font-size: 1.5em;
  }
}

.disconnect-btn {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.9em;

  &:hover {
    background: #c0392b;
  }
}

.word-display {
  background: #f8f9fa;
  padding: 15px;
  text-align: center;
  border-bottom: 1px solid #dee2e6;

  h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.3em;
  }
}

/* 主工具栏样式 */
.top-toolbar {
  display: flex;
  justify-content: center;
  align-items: center;  /* 垂直居中对齐 */
  gap: 15px;
  padding: 10px;
  background: rgba(255,255,255,0.9);
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  position: relative;
  z-index: 10;
  height: 60px;  /* 固定高度 */

  /* 颜色选择器下拉菜单 */
  .color-picker-dropdown {
    position: relative;
    display: inline-block;
    margin-left: 10px;
    
    .color-picker-btn {
      width: 50px;
      height: 50px;
      border-radius: 50%;
      background: #fff;
      border: 2px solid #ddd;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: all 0.2s ease;
      
      &:hover {
        border-color: #4a90e2;
      }
    }
    
    .color-picker-menu {
      position: absolute;
      top: 100%;
      left: 0;
      background: white;
      border-radius: 10px;
      padding: 10px;
      box-shadow: 0 4px 8px rgba(0,0,0,0.1);
      display: none;
      z-index: 20;
      
      &.show {
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: 60px;
        max-height: 300px;
        overflow-y: auto;
      }
    }
  }
}

/* 画布容器 - 正方形画布优化 */
.canvas-wrapper {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  position: relative;
  /* 动态高度计算，为正方形画布预留空间 */
  height: calc(100vh - 200px); /* 减去顶部工具栏(60px) + 底部栏(60px) + 额外边距 */
  max-height: 60vh; /* 限制最大高度，确保正方形画布能完整显示 */
  overflow: hidden; /* 防止内容溢出 */
}

/* 正方形画布样式 */
.drawing-canvas {
  background-color: #fff;
  touch-action: none;
  user-select: none;
  border: 2px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  /* 画布尺寸由JavaScript动态设置为正方形 */
}

/* 底部题目显示 */
.word-display {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 15px;
  text-align: center;
  font-size: 1.2em;
  z-index: 100;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none; /* 防止遮挡画布操作 */
  
  h3 {
    margin: 0;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
  }
}

.tool-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: all 0.2s ease;

  &.active {
    border-color: #4a90e2;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(74,144,226,0.3);
    
    .icon {
      color: #4a90e2;
    }
  }

  /* 画笔按钮特殊样式 */
  &:first-child.active {
    border-color: #4a90e2;
  }

  /* 橡皮擦按钮特殊样式 */
  &:nth-child(2).active {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231,76,60,0.3);
    
    .icon {
      color: #e74c3c;
    }
  }

  .icon {
    font-size: 20px;
    color: #333;
    transition: color 0.2s ease;
  }
}

.color-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.color-option {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;

  &:hover {
    transform: scale(1.1);
  }

  &.active {
    border-color: #333;
    transform: scale(1.1);
    box-shadow: 0 0 0 2px rgba(74,144,226,0.5);
  }
}

.brush-size-slider {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
}

.brush-slider {
  width: 100%;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 2px;
  background: #ddd;
  outline: none;

  &::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4a90e2;
    cursor: pointer;
  }
}

.brush-preview {
  border-radius: 50%;
  border: 1px solid #ddd;
  margin-top: 5px;
}

/* 表情选择器样式 */
.emoji-picker-dropdown {
  position: relative;
  display: inline-block;
  
  .emoji-picker-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 20px;
    
    &:hover {
      border-color: #4a90e2;
      transform: scale(1.05);
    }
  }
  
  .emoji-picker-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    display: none;
    z-index: 30;
    width: 280px;
    max-height: 350px;
    
    &.show {
      display: block;
    }
    
    .emoji-categories {
      display: flex;
      justify-content: space-between;
      margin-bottom: 15px;
      border-bottom: 1px solid #eee;
      padding-bottom: 10px;
      
      .category-btn {
        background: none;
        border: none;
        font-size: 18px;
        padding: 8px;
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.2s ease;
        
        &:hover {
          background: #f0f0f0;
        }
        
        &.active {
          background: #4a90e2;
          color: white;
        }
      }
    }
    
    .emoji-grid {
      display: grid;
      grid-template-columns: repeat(8, 1fr);
      gap: 8px;
      max-height: 240px;
      overflow-y: auto;
      
      .emoji-option {
        width: 30px;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        cursor: pointer;
        border-radius: 6px;
        transition: all 0.2s ease;
        
        &:hover {
          background: #f0f0f0;
          transform: scale(1.2);
        }
        
        &:active {
          transform: scale(1.1);
          background: #e0e0e0;
        }
      }
    }
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
